This was the main project I worked on while in the Cougs in Space club at WSU. The goal of Cougs in Space is to build a small 1U CubeSat that will eventually be launched into Low Earth Orbit. I was on the Attitude Control subteam which was tasked with building the satellite's ADCS (Attitude Determination and Control System). The chosen Attitude Control method was magnetorquers, which have the advantage of being simple and requiring little energy. However, they have a key limitation, which is that unlike reaction wheels they can't produce a torque in any desired direction. They are instead limited to torques in the plane perpendicular to the vector of the earth's magnetic field. This makes developing a control system considerably more complex as the subspace of available torques changes moment to moment. I spearheaded the design and creation of a Simulink model that we used to test the first version of the ADCS. This version was inadequate in a number of ways, but it gave a good base for the new version which we're working on right now. The new version, which can be seen in the gif above, is being modeled in Python instead of Simulink for the increased flexibility. It is far more robust, and in its current state is capable of pointing a fixed camera on the satellite in any direction in 99% of cases based on a monte-carlo simulation. The average time it takes to do this is just over 5 minutes.
The 3D plot generated by the most recent version of the model can be seen above next to the title. The target, a point on the earth, is shown in blue, while the camera's direction can be seen in yellow. The yellow trace is the path the camera took to point at the target. Other vectors are also shown, but I hid their traces for readability (with the exception of the Earth Magnetic Field vector and Target vector, which are updated using orbital propagation in this model). The series of plots shown above are for a different run of the simulation.